package com.smedi.ismedi.inmail.core.domain.repository;

import com.smedi.ismedi.inmail.core.domain.aggregatemodel.announcement.AnnouncementReceiverRelationship;

import java.util.List;

/**
 * 接收者关系仓库
 *
 * @author jiangqinxuan
 * @date 2021/07/27
 */
public interface AnnouncementReceiverRelationshipRepository {
    /**
     * 公告与接收者关系表的插入接口
     *
     * @param announcementReceiverRelationship 通知公告与接收者关系业务类
     */
    void doInsert(AnnouncementReceiverRelationship announcementReceiverRelationship);

    /**
     * 查询公告与接收者关系是否已经存在
     *
     * @param announcementId 通知公告id
     * @param receiverId     接收人id
     * @return Boolean
     */
    Boolean doQueryStatusByAnnouncementIdAndReceiverId(Long announcementId, Long receiverId);

    /**
     * 通过当前用户查询所属通知公告
     *
     * @param currentUserId 当前登陆人id
     * @return List<Long>
     */
    List<Long> doSelectAnnouncementIdByReceiverId(Long currentUserId);

    /**
     * 依据当前登陆人更改接收者关系表的已读状态
     *
     * @param announcementId 通知公告id
     * @param currentUserId  当前登陆人id
     */
    void doUpdateReadByAnnouncementIdAndCurrentUserId(Long announcementId, Long currentUserId);

    /**
     * 依据当前登陆人查找接收者关系表的已读状态
     *
     * @param announcementId 通知公告id
     * @param currentUserId  当前登陆人id
     * @return Boolean
     */
    Boolean doSelectReadByAnnouncementIdAndCurrentUserId(Long announcementId, Long currentUserId);
}